<template>
  <div>

    <div >
                <table class="mars" cellspacing="1" cellpadding="0" width="100%" border="0">
                  <tbody>
                    <tr bgcolor="#fba661" height="30">
                      <td width="7%"><div align="center">编号ID</div></td>
                      <td width="8%"><div align="center">单位名称</div></td>
                      <td width="15%"><div align="center">单位地址</div></td>
                      <td width="8%"><div align="center">法人</div></td>
                      <td width="8%"><div align="center">注册资金</div></td>
                      <td width="7%"><div align="center">性质</div></td>
                      <td width="10%"><div align="center">电话</div></td>
                      <td width="19%"><div align="center">简介</div></td>
                      <td width="9%"><div align="center">修改</div></td>
                      <td width="9%"><div align="center">删除</div></td>
                    </tr>
                    <tr bgcolor="#e4f1fe" v-for="(unit,index) in unitList" :key="index">
                      <td bgcolor="#f3f3f3"><div align="center">{{unit.uid}}</div></td>
                      <td bgcolor="#f3f3f3"><div align="center">{{unit.unitname}}</div></td>
                      <td bgcolor="#f3f3f3"><div align="center">{{unit.address}}</div></td>
                      <td bgcolor="#f3f3f3"><div align="center">{{unit.corporation}}</div></td>
                      <td bgcolor="#f3f3f3"><div align="center">{{unit.investment}}</div></td>
                      <td bgcolor="#f3f3f3"><div align="center">{{unit.type}}</div></td>
                      <td bgcolor="#f3f3f3"><div align="center">{{unit.tel}}</div></td>
                      <td bgcolor="#f3f3f3"><div align="center">{{unit.introduction}}</div></td>
                      <td bgcolor="#f3f3f3"><div align="center"><a href="#" @click="gotoUpdateUnit(index)">修改</a></div></td>
                      <td bgcolor="#f3f3f3"><div align="center"><a href="#" @click="gotoUpdateUnit(index)">删除</a></div></td>
                    </tr>
                  </tbody>
                </table>
                  </div>

     <div id="container" >
    <div id="footer">
    <p><a href="http://www.ascenttech.com.cn/" target="_blank">版权所有：北京亚思晟商务科技有限公司 &copy;2004-2008|京ICP备05005681</a></p>
    </div>
    </div>

  </div>
</template>

<script>
export default {
data:function() {
return {
      unit:{
        uid: "",
        unitname: "",
        address: "",
        corporation: "",
        investment: "",
        type: "",
        tel: "",
        email: "",
        fax: "",
        zipcode: "",
        introduction: ""
      },
      unitList:''


    };
},
    mounted(){
      this.getAllUnit();
    },
    methods: {
      getAllUnit:function ()
      {
        this.$axios.get(
                "http://localhost:8080/api/unitmessage"
        )
                .then((resp)=>
                {
                  this.unitList=resp.data.data

                  console.log(resp.data.code+" "+resp.data.msg)
                })
      },
      gotoUpdateUnit:function (index)
      {
        localStorage.setItem("unit",JSON.stringify(this.unitList[index]))
        location.href="/declare/admin/UpdateUnit";
      }
    }
}
</script>

<style>
@import '@/assets/css/andreas08(blue).css'

</style>